"use strict";
cc._RF.push(module, '5a642Rb6oxLjo8KdIbOoK01', 'AddScore');
// Script/colider/AddScore.ts

Object.defineProperty(exports, "__esModule", { value: true });
var NumberShow_1 = require("../number/NumberShow");
var Constant_1 = require("../constant/Constant");
// Learn TypeScript:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var AddScoreNode = /** @class */ (function (_super) {
    __extends(AddScoreNode, _super);
    function AddScoreNode() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.scoreAdder = null;
        _this.count = 0; //碰撞计数器
        return _this;
    }
    AddScoreNode.prototype.start = function () {
    };
    /**
     * 加分逻辑
     * @param other
     */
    AddScoreNode.prototype.onCollisionEnter = function (other) {
        var otherNode = other.node;
        var t = this;
        if (otherNode.name == "Left")
            t.count++;
        if (otherNode.name == "Right")
            t.count++;
        if (t.count == 2) {
            t.count = 0;
            Constant_1.Constant.NOW_SCORE++;
            t.scoreAdder.getComponent(NumberShow_1.default).showNumber(Constant_1.Constant.NOW_SCORE);
        }
    };
    AddScoreNode.prototype.onCollisionExit = function (other) {
        // cc.log("exit" + other.name);
        // let name = other.name;
        // if (name == "left" || name == "right") {
        //     cc.log("exit");
        // }
    };
    AddScoreNode.prototype.onCollisionStay = function (other) {
        // cc.log("stay" + other.name);
        // let name = other.name;
        // if (name == "left" || name == "right") {
        //     cc.log("stay");
        // }
    };
    AddScoreNode.prototype.update = function (dt) {
    };
    __decorate([
        property(cc.Node)
    ], AddScoreNode.prototype, "scoreAdder", void 0);
    AddScoreNode = __decorate([
        ccclass
    ], AddScoreNode);
    return AddScoreNode;
}(cc.Component));
exports.default = AddScoreNode;

cc._RF.pop();